from PyQt4 import QtGui
#import wx
#fafrom wx.lib.pubsub import Publisher as pub

class MainView(QtGui.QWidget):
    def __init__(self,parent=None):
            super(MainView, self).__init__(parent)
            #bleg = wx.Frame
            self.initUI()
    
    def initUI(self):
            # Defining all the widgets before placing them into boxes
            MusicSettingsBox = QtGui.QVBoxLayout()
            MusicSettingsBox.addStretch(1)
            BPMLabel = QtGui.QLabel("BPM")
            BPMLineEdit = QtGui.QLineEdit()
            BeatLabel = QtGui.QLabel("Beats")
            BeatComboBox = QtGui.QComboBox(self)
            BeatComboBox.addItem("1")
            BeatComboBox.addItem("2")
            BeatComboBox.addItem("3")
            BeatComboBox.addItem("4")
            BeatComboBox.addItem("5")
            BeatComboBox.addItem("6")
            BeatComboBox.addItem("7")
            BeatComboBox.addItem("8")
            BeatComboBox.addItem("9")
            BeatComboBox.addItem("10")
            BeatComboBox.addItem("11")
            BeatComboBox.addItem("12")
            BeatComboBox.setCurrentIndex(3)
            NoteValueLabel = QtGui.QLabel("Note Value")
            NoteValueComboBox = QtGui.QComboBox(self)
            NoteValueComboBox.addItem('Whole Note')
            NoteValueComboBox.addItem('Half Note')
            NoteValueComboBox.addItem('Quater Note')
            NoteValueComboBox.addItem('Eighth Note')
            NoteValueComboBox.addItem('Sixteenth Note')
            NoteValueComboBox.setCurrentIndex(2)
            
            MusicSettingsBox.addWidget(BPMLabel)
            MusicSettingsBox.addWidget(BPMLineEdit)
            MusicSettingsBox.addWidget(BeatLabel)
            MusicSettingsBox.addWidget(BeatComboBox)
            MusicSettingsBox.addWidget(NoteValueLabel)
            MusicSettingsBox.addWidget(NoteValueComboBox)
            
            AlgorithmSettingsBox = QtGui.QVBoxLayout()
            AlgorithmSettingsBox.addStretch(1)
            AlgorithmLabel = QtGui.QLabel("Algorithm")
            AlgorithmLineEdit = QtGui.QLineEdit()
            AlgorithmSettingsBox.addWidget(AlgorithmLabel)
            AlgorithmSettingsBox.addWidget(AlgorithmLineEdit)
            
            FileSettingsBox = QtGui.QVBoxLayout()
            FileSettingsBox.addStretch(1)
            FileLabel = QtGui.QLabel("File")
            FileLineEdit = QtGui.QLineEdit()
            FileSettingsBox.addWidget(FileLabel)
            FileSettingsBox.addWidget(FileLineEdit)
            
            DataSettingsBox = QtGui.QVBoxLayout()
            DataSettingsBox.addStretch(1)
            DataLabel = QtGui.QLabel("Data")
            DataLineEdit = QtGui.QLineEdit()
            DataSettingsBox.addWidget(DataLabel)
            DataSettingsBox.addWidget(DataLineEdit)
            
            # BUTTONS!!!
            GenerateButton = QtGui.QPushButton("Generate")
                  
        
            # Setting up vertical boxes
            TopHBox = QtGui.QHBoxLayout()
            TopHBox.addStretch(0)
            TopHBox.addLayout(MusicSettingsBox)
            TopHBox.addLayout(AlgorithmSettingsBox)
            
            MiddleHBox = QtGui.QHBoxLayout()
            MiddleHBox.addStretch(0)
            MiddleHBox.addLayout(FileSettingsBox)
            MiddleHBox.addLayout(DataSettingsBox)           
            
            BottomHBox = QtGui.QHBoxLayout()
            BottomHBox.addStretch(0)
            BottomHBox.addWidget(GenerateButton)
            # Setting horizontal boxes
            VBox = QtGui.QVBoxLayout()
            VBox.addStretch(1)
            VBox.addLayout(TopHBox)
            VBox.addLayout(MiddleHBox)
            VBox.addLayout(BottomHBox)
            
            
            # Main Window settings
            self.setLayout(VBox)
            self.setGeometry(300,300,300,150)
            
            self.setWindowTitle('Sounds of Math')
            self.show()
            self.setWindowTitle("Sounds of Math")